class_name PlayerWallState
extends GameplayStateMachine

@onready var player: Player = $"../../"


func _on_setup() -> void:
	var multiway_transition: GameplayMultiwayTransition = GameplayMultiwayTransition.new(
		[
			func(): return 0 if player.player_state_checker.is_wall_top_detected else 1,
			func(): return 0 if player.player_input_handler.climb_input else 1
		],
		{
			[0, 0]: "PlayerLedgeClimbState",
			[0, 1]: "PlayerLedgeGrabState",
			[1, 0]: "PlayerWallClimbState",
			[1, 1]: "PlayerWallSlideState"
		}
	)

	add_transition("GhostState", multiway_transition)
	add_transition("PlayerLedgeGrabState", multiway_transition)
	add_transition("PlayerWallClimbState", multiway_transition)
	add_transition("PlayerWallSlideState", multiway_transition)

	add_transition("PlayerLedgeGrabState", GameplaySimpleTransition.new("PlayerLedgeClimbState", func(): return player.player_input_handler.jump_input, func(): pass))
